﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<KLS.PPDS.Web.Models.StoryboardViewModel>" %>
<%@ Import Namespace="KLS.PPDS.Utility.Extension" %>


<%if (Model.Publication != null)
  {
      for (int i = 1; i <= Model.Publication.Pages; i++)
      {


         
%>

 <%= Model.DivOpen(i, Model.Publication.Pages.GetValueOrDefault(1)) %>

<div id="pg-<%=i.ToString() %>" class="ui-widget-content Page droppable <%=Model.PageCss(i,Model.Publication.Pages.GetValueOrDefault(1)) %> ">



    <%
          var articleList = Model.GetArticleByPageNumber(i);

        if (articleList != null)
{
    foreach (var article in articleList)
{
  

              %>
              
              <div id="pg<%=i.ToString()+"art-"+article.Id %>" class="draggable  article-region <%=Model.ArticleCss(i,article) %> ">
                 <label  onclick="<%=string.Format("OpenArticle('/Article/index?publicationId={0}&&articleId={1}')",Model.Publication.Id,article.Id) %>"  title="<%=article.Headline %>" ><%=article.Headline.Trancate(11) %></label>
                 <%if(article.Content.Count()>0)
                    {
                        foreach (var articleContent in article.Content)
                            {
                                if (!string.IsNullOrEmpty(articleContent.Headline))
                                {
                            %>
                              <br />
                              <label class="<%=Model.ArticleContentCss(articleContent) %>" onclick="<%=string.Format("OpenArticle('/Article/index?publicationId={0}&&articleId={1}')",Model.Publication.Id,article.Id) %>"  title="<%=articleContent.Headline %>" ><%=articleContent.Headline.Trancate(11)%></label>
                            <%
                                }
  
                            }
        
                    } %>
                                  
              </div>
              <%-- <br />--%>
        
              <%
}
}
          %>    

            
     <label class="pageNumber"><%=i.ToString()%></label>
</div>

 <%= Model.DivClose(i, Model.Publication.Pages.GetValueOrDefault(1)) %>
<%}


      Model.AddArticleForEmtpyStandBy(); // atlest two stand by page sholdbe in the storyboard
    Html.RenderPartial("~/Views/Storyboard/StandByPage.ascx", Model.StandByArticleList);


      
  }%>